home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / infosrvr / dev / scott / WWW / NextStep / Implementation / HText.m < prev    next >
Text File  |  1993-02-19  |  2KB  |  122 lines

  1. /*    WWW Library functions
  2. **    ---------------------
  3. **
  4. ** This links the WWW library to the NeXt world.
  5. **
  6. **  Types to be equated:   HyperText        HText
  7. **               Anchor        Anchor
  8. **               HTStyle        HTStyle  same?
  9. */
  10.  
  11. #import "HyperText.h"        /* NextStep style */
  12.  
  13. /*    Exports
  14. */ 
  15. PUBLIC HText * HTMainText = 0;        /* Equivalent of main window */
  16. PUBLIC HTParentAnchor * HTMainAnchor = 0;    /* Anchor for HTMainText */
  17.  
  18.  
  19.  
  20. /*                B U I L D I N G
  21. */
  22.  
  23. PUBLIC HText * HText_new (HTParentAnchor *anchor)
  24. {
  25.     HText * HT = [HyperText newAnchor:anchor];
  26.     HTMainAnchor = anchor;
  27.     HTMainText = HT;
  28.     
  29.     [HT setupWindow];            
  30.     [HT setEditable:NO];            /* This is read-only data */
  31.  
  32.     return HT;
  33. }
  34.  
  35. PUBLIC HText * HText_new2 (HTParentAnchor *anchor, HTStream* sink)
  36. {
  37.     HText * HT = [HyperText newAnchor:anchor];
  38.     HTMainAnchor = anchor;
  39.     HTMainText = HT;
  40.     
  41.     [HT setupWindow];            
  42.     [HT setEditable:NO];            /* This is read-only data */
  43.  
  44.     return HT;
  45. }
  46.  
  47. PUBLIC void HText_free(HText * me)
  48. {
  49.     [me free];
  50. }
  51.  
  52. PUBLIC void HText_beginAppend(HText * me)
  53. {
  54.     [me appendBegin];
  55. }
  56.  
  57. PUBLIC void HText_endAppend(HText * me)
  58. {
  59.     [me appendEnd];
  60.     if (HTList_indexOf(
  61.         HTAnchor_methods([me nodeAnchor]),
  62.     HTAtom_for("PUT")) != (-1)) {
  63.             [me setEditable:YES];    
  64.     }
  65. }
  66.  
  67. PUBLIC void HText_setStyle(HText * me, HTStyle * style)
  68. {
  69.     [me appendStyle:style];
  70. }
  71.  
  72. PUBLIC void HText_appendCharacter(HText * me, char ch)
  73. {
  74.     [me appendCharacter:ch];
  75. }
  76.  
  77. PUBLIC void HText_appendText(HText * me, const char * str)
  78. {
  79.     [me appendText:str];
  80. }
  81.  
  82. PUBLIC void HText_appendParagraph(HText * me)
  83. {
  84.     [me appendCharacter:'\n'];
  85. }
  86.  
  87. PUBLIC void HText_beginAnchor(HText * me, HTChildAnchor * anc)
  88. {
  89.     [me appendBeginAnchor:anc];
  90. }
  91.  
  92. PUBLIC void HText_endAnchor(HText * me)
  93. {
  94.     [me appendEndAnchor];
  95. }
  96.  
  97. /*                B R O W S I N G
  98. */
  99.  
  100. PUBLIC BOOL HText_select(HText * me)
  101. {
  102.     id status = [me selectAnchor:NULL];
  103.     if (!status) return NO;
  104.     
  105.     HTMainAnchor = [me nodeAnchor];
  106.     HTMainText = me;
  107.     return YES;
  108. }
  109.  
  110. PUBLIC BOOL HText_selectAnchor(HText * me, HTChildAnchor * anchor)
  111. {
  112.     id status = [me selectAnchor:anchor];
  113.     if (!status) return NO;
  114.     
  115.     HTMainAnchor = [me nodeAnchor];
  116.     HTMainText = me;
  117.     return YES;
  118. }
  119.  
  120. /*        editing functions not supported
  121. */
  122.